<template>
    <div>
        添加表
        <p>名称:<input type="text" label='名称' placeholder="请输入名称" v-model="form.name"></p>
        <p>参数:<input type="text" label='参数' placeholder="请输入参数" v-model="form.parameter"></p>
        <button @click="add">
            添加
        </button> <br/><br/>

        展示表
        <table border="1">
            <tr>
                <td>id</td>
                <td>名称</td>
                <td>参数</td>
            </tr>
            <tr v-for="i in worklist">
                <td>{{i.id}}</td>
                <td>{{i.name}}</td>
                <td>{{i.parameter}}</td>
            </tr>
        </table>
        {{worklist}}
    </div>
</template>

<script>
    export default {
        data(){
            return{
                form:{},
                worklist:[],
            }
        },
        methods:{
            add(){
                this.$axios.post('workM',this.form)
                .then(res=>{
                    if(res.data.code==200){
                        alert('添加成功')
                    }
                })
            },
            get_worklist(){
                this.$axios.get('workM')
                .then(res=>{
                    this.worklist=res.data.list
                })
            },
        },
        mounted(){
            this.get_worklist()
        },
    }
</script>

<style scoped>

</style>